package ahg;

import org.junit.Test; 

import robocode.Bullet;
import static org.junit.Assert.*;

/**
 * Tests CakeBot's evade method.
 * @author Tony Gaskell
 *
 */
public class TestCakeBotEvade { 

  /**
   * Makes sure that the bot's heading changes negatively when hit from the left
   * and positively when hit from the right.
   */
  @Test
  public void test() {
    CakeBot cakeBot = new CakeBot();
    double myHeading = 0;
    Bullet bullet = new Bullet(0, 0, 0, 1, "Enemy", "CakeBot", true, 1);

    myHeading = cakeBot.evade(bullet.getHeading());
    assertEquals(45, myHeading, 360);
    System.out.println("Evade test 1: Passed!");

    myHeading = cakeBot.evade(bullet.getHeading() + 10);
    assertEquals(45, myHeading, 360);
    System.out.println("Evade test 2: Passed!");

    myHeading = cakeBot.evade(bullet.getHeading() - 10);
    assertEquals(-45, myHeading, 360);
    System.out.println ("Evade test 3: Passed!");
  }
}
